(** *)

(** The constant greek pi*)
let pi = 3.14159265;;

(** Convert the angle expressed in degrees
  to an angle as part of 2*.pi *) 
let angle_in_degrees_to_angle_in_float (angle:int)= 
  (* We leave the code as it stands,
  as it is optimized by the compiler *)
  ((2. *. pi)/.360.) *. (float_of_int angle)
;;

(** The computation of the vmg.
  We export only this value from the module
  @param heading the actual direction
  @param speed the actual speed
  @param goodheading the wished direction
  @return the speed in the direction goodheading.
*)
let vmg (heading,speed,goodheading) =
  let
    int_angle = abs (heading - goodheading)
  in
  let
    float_angle = angle_in_degrees_to_angle_in_float int_angle
  in
    (cos float_angle)*.speed;;
